<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
set_html('title','登录中心');
if($_RQ['op']=='get'){
	$return['set']=$this->plugin_setting('setting');
	$return['set']['loginlogo']=tomedia($return['set']['loginlogo']);
	$return['set']['loginbg']=tomedia($return['set']['loginbg']);
	if($_SESSION['os']=='windows'){
		$return['session_id']=session_id();
	}
	if($_SESSION['uid'] && !$_RQ['loginup']){
		exi('','error','jy_quanfee/index/');
	}
	$_SESSION['logout_forward']='jy_quanfee/login/';
	$_SESSION['forward_url']='jy_quanfee/index/'; 
	$return['forward_url']=base64_encode($_SESSION['forward_url']);
	$return['info']=array();
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	if(!$post['password'] || !$post['username']){
		exi('请填写账户名和密码','error');
	}
	$user=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'username'=>$post['username']));
	if(!check_password($post['password'],$user['salt'],$user['password'])){
		exi('账号或密码错误!','error');
	}
	model('core/member')->login($user['id']);
	//绝对地址，会刷新页面
	$url=custom_url('jy_quanfee/index/',true);
	exi('登陆成功!','',$url);
	
}